
<!DOCTYPE html>
<html>
<head>
    <meta content="text/html;charset=utf-8" http-equiv="Content-Type" />
    <meta content="width=device-width, initial-scale=1.0, maximum-scale=1.0, user-scalable=no" name="viewport" />
    <meta http-equiv="Content-Security-Policy" content="upgrade-insecure-requests" />
    <meta http-equiv="X-UA-Compatible" content="IE=edge,Chrome=1" />
    <meta http-equiv="Expires" CONTENT="0">
    <meta http-equiv="Cache-Control" CONTENT="no-cache">
    <meta http-equiv="Pragma" CONTENT="no-cache">
    <meta name="renderer" content="webkit" />
    <title>注册 - ${site.siteName!}</title>
    <meta name="keywords" content="${site.keywords!}" />
    <meta name="description" content="${site.description!}"  />
    <link href="/default/css/bootstrap.css" rel="stylesheet" type="text/css" />
    <link href="/default/css/icon.css" rel="stylesheet" type="text/css" />
    <link href="/default/css/common.css" rel="stylesheet" type="text/css" />
    <link href="/default/css/register.css" rel="stylesheet" type="text/css" />
    <link href="/default/css/link.css" rel="stylesheet" type="text/css" />
    <link href="/default/css/verify.css" rel="stylesheet" type="text/css">
    <script src="/default/js/jquery.min.js"></script>
    <script src="/vendors/layer/layer.js" type="text/javascript"></script>
    <script src="/vendors/bootstrap/js/bootstrap.min.js"></script>
    <script src="/default/js/crypto-js.js"></script>
    <script src="/default/js/ase.js"></script>
    <script src="/default/js/verify.js" ></script>
</head>
<noscript unselectable="on" id="noscript">
    <div class="aw-404 aw-404-wrap container">
        <img src="/default/common/no-js.jpg">
        <p>你的浏览器禁用了JavaScript, 请开启后刷新浏览器获得更好的体验!</p>
    </div>
</noscript>
<style type="text/css">
    .oldPwdTip {
        position: absolute;
        color: rgba(153, 153, 153, 1);
        margin-top: 6px;
        margin-left: 0px;
        text-align: left;
        left: 0px;
        top: -5px;
        padding: 0 15px;
        width: 100%;
        height: 40px;
        line-height: 38px;
        color: #777777;
    }
</style>
<div class="aw-register-box">
    <div class="mod-head">
        <a href="https://www.97560.com">
            <img src="/default/css/img/login_logo.png" alt=""/>
        </a>
        <h1>注册新用户</h1>
    </div>
    <div class="mod-body">
        <form class="aw-register-form" action="/register/add/email" method="post" id="register_form">
            <ul>
                <li class="alert alert-danger collapse error_message text-left"><i class="icon icon-delete"></i> <em></em></li>
                <li><input class="aw-register-name form-control" type="text" name="username" placeholder="用户名" tips="请输入一个2-16 位的用户名,允许字母、中文、+数字" errortips="用户名长度不符合" value="" /></li>
                <li><input class="aw-register-email form-control" type="text" placeholder="邮箱" name="email" tips="请输入你常用的电子邮箱作为你的账号" value="" errortips="邮箱格式不正确" /></li>
                <li>
                    <label class="oldPwdTip aw-register-pwd-label">密码</label>
                    <input class="aw-register-pwd form-control" id='aw-register-pwd' type="password" name="password" tips="请输入 6-16 个字符,区分大小写" errortips="密码不符合规则"/>
                </li>
                <li class="more-information collapse">
                    <ul>
                        <li>
                            性别:
                            <label>
                                <input name="sex" value="1" type="radio" /> 男
                            </label>&nbsp;
                            <label>
                                <input name="sex" value="2" type="radio" /> 女 </label>&nbsp;
                            <label>
                                <input name="sex" value="3" type="radio" checked="checked" /> 保密
                            </label>
                        </li>
                        <li>
                            职业:
                            <select name="job_id" class="form-control" >
                                <option value="">--</option>
                                <option value="1">站长</option>
                                <option value="2">产品经理</option>
                                <option value="3">视觉设计师</option>
                                <option value="4">程序员</option>
                                <option value="5">前端工程师</option>
                                <option value="6">风险投资者</option>
                                <option value="7">职业经理人</option>
                                <option value="8">运营人员</option>
                                <option value="9">人力资源</option>
                                <option value="10">运维人员</option>
                                <option value="11">创业者</option>
                                <option value="12">媒体</option>
                                <option value="13">天使</option>
                                <option value="14">学生</option>
                                <option value="17">其他</option>
                            </select>
                        </li>
                        <li>
                            所在城市:
                            <select name="province" class="form-control" style="display:inline-block"></select>

                            <select name="city" class="form-control"></select>
                        </li>
                        <li>
                            <input type="text" class="form-control" placeholder="一句话介绍" id="welcome_signature" value="" name="signature" />
                        </li>
                    </ul>
                </li>
                <li>
                    <hr />
                    <a class="more-information-btn">更多资料</a>
                </li>
                <li>
                    <div style="width: 100%;">
                        <div class="yidun_intellisense yidun_intellisense--light" style="">
                            <div class="yidun_intelli-control">
                                <div class="yidun_intelli-tips" id="j-captcha-sense">
                                    <div class="yidun_intelli-icon">
                                        <span class="yidun_logo"></span>
                                        <span class="yidun_intelli-loading"></span>
                                        <div class="yidun_ball-scale-multiple"></div>
                                    </div>
                                    <span class="yidun_intelli-text">点击完成验证</span>
                                </div>
                                <div class="yidun_classic-tips">
                                    <span class="glyphicon glyphicon-ok"></span>
                                    <span class="yidun_tips__text yidun-fallback__tip">验证成功</span>
                                </div>
                                <div class="yidun_tips" style="line-height: 40px">
                                    <span class="glyphicon glyphicon-remove"></span>
                                    <span class="yidun_tips__text yidun-fallback__tip">验证失败，点此重试</span>
                                </div>
                            </div>
                        </div>
                        <input type="hidden" name="captcha" id="captcha" value="">
                    </div>
                    <div id="mpanel2" style="margin-top:50px;"></div>
                </li>
                <li class="last">
                    <label><input type="checkbox" checked="checked" value="agree" name="agreement_chk" /> 我同意</label>
                    <a href="javascript:;" class="aw-agreement-btn">用户协议</a>
                    <a href="/user/login" class="pull-right">已有账号?</a>
                    <a href="/register/phone" class="pull-right" style="margin-right: 5px;">手机注册</a>
                    <div class="aw-register-agreement collapse">
                        <div class="aw-register-agreement-txt" id="register_agreement"></div>
                    </div>
                </li>
                <li class="clearfix">
                    <button class="btn btn-large btn-blue btn-block" id="zhuce">注册</button>
                </li>
            </ul>
        </form>
    </div>
    <div class="mod-footer"></div>
</div>
<script type="text/javascript">
    $(".aw-register-pwd").prev(".oldPwdTip").click(function(){
        $(".aw-register-pwd").focus();
    });
    $(".aw-register-pwd").focus(function(){
        $(".oldPwdTip").hide();
    });
    $(".aw-register-pwd").blur(function(){
        if(!$(this).val())
            $(".oldPwdTip").show();
    });
    var mobile;
    $(document).ready(function (){
        //$.get('/account/ajax/register_agreement/', function (result) { $('#register_agreement').html(result.err); }, 'json');
        $('.aw-agreement-btn').click(function()
        {
            if ($('.aw-register-agreement').is(':visible'))
            {
                $('.aw-register-agreement').hide();
            }
            else
            {
                $('.aw-register-agreement').show();
            }
        });

        $('.more-information-btn').click(function()
        {
            $('.more-information').fadeIn();
            $(this).parent().hide();
        });

        verify_register_form('#register_form');

        /* 注册页面验证 */
        function verify_register_form(element)
        {

            $(element).find('[type=text], [type=password]').on({
                focus : function()
                {
                    if (typeof $(this).attr('tips') != 'undefined' && $(this).attr('tips') != '')
                    {
                        $(this).parent().append('<b class="aw-reg-tips">' + $(this).attr('tips') + '</b>');
                    }
                },
                blur : function()
                {
                    if ($(this).attr('tips') != '')
                    {
                        switch ($(this).attr('name'))
                        {
                            case 'username' :
                                var _this = $(this);
                                var min_length=2;
                                var max_length=16;
                                $(this).parent().find('.aw-reg-tips').detach();
                                if (strlen($(this).val()) >= 0 && strlen($(this).val())< min_length)
                                {
                                    $(this).parent().find('.aw-reg-tips').detach();
                                    $(this).parent().append('<b class="aw-reg-tips aw-reg-err"><i class="aw-icon i-err"></i>' + $(this).attr('errortips') + '</b>');
                                    return;
                                }
                                if (strlen($(this).val()) > max_length)
                                {
                                    $(this).parent().find('.aw-reg-tips').detach();
                                    $(this).parent().append('<b class="aw-reg-tips aw-reg-err"><i class="aw-icon i-err"></i>' + $(this).attr('errortips') + '</b>');
                                    return;
                                }
                                else
                                {
                                    $.post( '/account/ajax/check_username/',
                                        {
                                            username: $(this).val()
                                        }, function (result) {
                                            if (result.code==200) {
                                                _this.parent().find('.aw-reg-tips').detach();
                                                _this.parent().append('<b class="aw-reg-tips aw-reg-right"><i class="aw-icon i-followed"></i></b>');

                                            } else {
                                                _this.parent().find('.aw-reg-tips').detach();
                                                _this.parent().append('<b class="aw-reg-tips aw-reg-err"><i class="aw-icon i-err"></i>' + result.msg + '</b>');
                                            }
                                        }, 'json');
                                }
                                return;
                            case 'email' :
                                $(this).parent().find('.aw-reg-tips').detach();
                                var emailreg = /^\w+((-\w+)|(\.\w+))*\@[A-Za-z0-9]+((\.|-)[A-Za-z0-9]+)*\.[A-Za-z0-9]+$/;
                                if (!emailreg.test($(this).val())) {
                                    $(this).parent().find('.aw-reg-tips').detach();
                                    $(this).parent().append('<b class="aw-reg-tips aw-reg-err"><i class="aw-icon i-err"></i>' + $(this).attr('errortips') + '</b>');
                                    return;
                                }  else {
                                    $.post( '/account/ajax/check_email/',
                                        {
                                            useremail: $(this).val()
                                        }, function (result) {
                                            if (result.code==200) {
                                                _this.parent().find('.aw-reg-tips').detach();
                                                _this.parent().append('<b class="aw-reg-tips aw-reg-right"><i class="aw-icon i-followed"></i></b>');

                                            } else {
                                                _this.parent().find('.aw-reg-tips').detach();
                                                _this.parent().append('<b class="aw-reg-tips aw-reg-err"><i class="aw-icon i-err"></i>' + result.msg + '</b>');
                                            }
                                        }, 'json');
                                }
                                return;

                            case 'password' :
                                $(this).parent().find('.aw-reg-tips').detach();
                                if ($(this).val().length >= 0 && $(this).val().length < 6)
                                {
                                    $(this).parent().find('.aw-reg-tips').detach();
                                    $(this).parent().append('<b class="aw-reg-tips aw-reg-err"><i class="aw-icon i-err"></i>' + $(this).attr('errortips') + '</b>');
                                    return;
                                }
                                if ($(this).val().length > 17)
                                {
                                    $(this).parent().find('.aw-reg-tips').detach();
                                    $(this).parent().append('<b class="aw-reg-tips aw-reg-err"><i class="aw-icon i-err"></i>' + $(this).attr('errortips') + '</b>');
                                    return;
                                }
                                else
                                {
                                    $(this).parent().find('.aw-reg-tips').detach();
                                    $(this).parent().append('<b class="aw-reg-tips aw-reg-right"><i class="aw-icon i-followed"></i></b>');
                                }
                                return;

                            case 'mobile':
                                $(this).parent().find('.aw-reg-tips').detach();
                                var phonereg = /^1[345789]\d{9}$/;
                                if (!phonereg.test($(this).val()))
                                {
                                    $(this).parent().find('.aw-reg-tips').detach();
                                    $(this).parent().append('<b class="aw-reg-tips aw-reg-err"><i class="aw-icon i-err"></i>' + $(this).attr('errortips') + '</b>');
                                    return;
                                }
                                else
                                {
                                    $(this).parent().find('.aw-reg-tips').detach();
                                }
                                return;

                            case 'smscode':
                                $(this).parent().find('.aw-reg-tips').detach();
                                if (!$(this).val())
                                {
                                    $(this).parent().find('.aw-reg-tips').detach();
                                    $(this).parent().append('<b class="aw-reg-tips aw-reg-err"><i class="aw-icon i-err"></i>' + $(this).attr('errortips') + '</b>');
                                    return;
                                }
                                else
                                {
                                    $(this).parent().find('.aw-reg-tips').detach();
                                }
                                return;
                        }
                    }
                }
            });
        }

        //判断字符长度
        function strlen(str){
            var len = 0;
            for (var i=0; i<str.length; i++) {
                var c = str.charCodeAt(i);
                //单字节加1
                if ((c >= 0x0001 && c <= 0x007e) || (0xff60<=c && c<=0xff9f)) {
                    len++;
                }
                else {
                    len+=2;
                }
            }
            return len;
        }

        // // 初始化验证码  弹出式
        $('#mpanel2').slideVerify({
            //baseUrl:'http://127.0.0.1:8080',  //服务器请求地址;
            baseUrl:'${site.siteUrl!}',
            mode:'pop',     //展示模式
            containerId:'j-captcha-sense',//pop模式 必填 被点击之后出现行为验证码的元素id
            imgSize : {       //图片的大小对象,有默认值{ width: '310px',height: '155px'},可省略
                width: '380px',
                height: '180px',
            },
            barSize:{          //下方滑块的大小对象,有默认值{ width: '310px',height: '50px'},可省略
                width: '380px',
                height: '40px',
            },
            beforeCheck:function(){  //检验参数合法性的函数  mode ="pop"有效
                var flag = true;
                //实现: 参数合法性的判断逻辑, 返回一个boolean值
                return flag
            },
            ready : function() {},  //加载完毕的回调
            success : function(params) { //成功的回调
                $("#captcha").val(params.captchaVerification);
                $(".yidun_intellisense").addClass("yidun_intellisense--success");
                $(".yidun_intelli-tips").hide();
                console.log("++++++++++"+$("#captcha").val());

                // params为返回的二次验证参数 需要在接下来的实现逻辑回传服务器
                // 例如: login($.extend({}, params))
            },
            error : function() {}        //失败的回调
        });

        $('#zhuce').click(function(){
            var captcha = $('#captcha').val();
            alert(captcha);
            if (captcha==null || captcha =="") {
                layer.msg('请先完成验证', {icon: 2});
                return false;
            } else{

            }
        });

        var handlerEmbed = function (captchaObj) {
            $("#Smsbtn").click(function (e) {
                var phonereg = /^1[3456789]\d{9}$/;
                var mobile = $('input[name="mobile"]').val();

                if(mobile=='' ){
                    AWS.alert("请输入手机号");
                    return false;
                }
                if(!phonereg.test(mobile)){
                    AWS.alert("手机号格式不正确");
                    return false;
                }
                if($('#Smsbtn').text()!="获取验证码"){
                    return false;
                }

                var validate = captchaObj.getValidate();
                if (!validate) {
                    AWS.alert("请先完成验证");
                    return false;
                } else{
                    $.post( '/account/ajax/check_mobile/',{
                        mobile:mobile,
                        type:'regist',
                    }, function (result)
                    {
                        if (result.errno == -1)
                        {
                            AWS.alert("手机号已经注册！");
                            captchaObj.reset();
                            return false;
                        }else{
                            $.ajax({
                                url: '/tools/sendSms/',
                                type: "post",
                                dataType: "json",
                                data: {
                                    mobile: mobile,
                                    challenge: '',
                                    geetest_challenge: validate.geetest_challenge,
                                    geetest_validate: validate.geetest_validate,
                                    geetest_seccode: validate.geetest_seccode,
                                    client_type: 'web',
                                    genre: '1'
                                },
                                success: function (result) {
                                    if(result.errno == -1)
                                    {
                                        AWS.alert(result.err);
                                        captchaObj.reset(); // 调用该接口进行重置
                                        return false;
                                    }else
                                    {
                                        AWS.alert(result.err);
                                        var count = 60;
                                        var inl = setInterval(function () {
                                            $('#Smsbtn').prop('disabled', true);
                                            count -= 1;
                                            var text = count + ' 秒';
                                            $.cookie("captcha", count, {path: '/', expires: (1/86400)*count});
                                            $('#Smsbtn').text(text);
                                            if (count <= 0) {
                                                clearInterval(inl);
                                                $('#Smsbtn').prop('disabled', false);
                                                $('#Smsbtn').text('获取验证码');
                                            }
                                        }, 1000);
                                        return true;
                                    }

                                }
                            });
                        }
                    }, 'json');
                }
            });

        };
    });
</script>
[#include "pc/default/common/footer.html"/]
</body>
</html>